<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .a{
            width: 200px;
            height: 200px;
            background-color: cornflowerblue;
            position: relative;
        }
        .test{
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            width: 50px;
            height: 50px;
            background-color: chartreuse;
            margin: auto;
        }
    </style>
</head>
<body>
    <div class="a">
        <div class="test"></div>
    </div>
</body>
</html>